package ch.zhaw.cctd.logic.event;

import java.rmi.Remote;
import java.rmi.RemoteException;

import ch.zhaw.cctd.domain.player.Player;

/**
 * Allgemeine Schnittstelle um alle EventListener zu registrieren und events auszulösen.
 * @author Benjamin Felder
 */
public interface EventHandler extends Remote {

	/**
	 * Adds a new <code>ChatEventListener</code> to the handler
	 * @see ChatEventListener
	 */
	public void addChatEventListener(final ChatEventListener l) throws RemoteException;

	/**
	 * Removes the specific <code>ChatEventListener</code> from the handler.
	 * Should be called before disconnect.
	 * @see ChatEventListener
	 */
	public void removeChatEventListener(final ChatEventListener l) throws RemoteException;
	
	/**
	 * Sends a new chat message to all clients
	 * @param origin	the name of the local user.
	 * @param message	the message to be sent
	 * @see ChatEventListener
	 */
	public void dispatchChatMessage(final Player origin,final String message) throws RemoteException;
	
	/**
	 * Adds a new <code>LobbyEventListener</code> to the handler.
	 * @see LobbyEventListener
	 */
	public void addLobbyEventListener(final LobbyEventListener l) throws RemoteException;
	
	/**
	 * Removes a specific <code>LobbyEventListener</code> from the handler.
	 * @see LobbyEventListener
	 */
	public void removeLobbyEventListener(final LobbyEventListener l) throws RemoteException;
	
	public void dispatchLobbyReady(final Player origin) throws RemoteException;

	public void dispatchLobbyUnready(final Player origin) throws RemoteException;
	
	public void dispatchLobbyGameStart(final Player origin) throws RemoteException;
	
	public void dispatchLobbyJoined(final Player origin) throws RemoteException;

	public void dispatchLobbyLeft(final Player origin) throws RemoteException;
}
